<?php
/* SVN FILE: $Id: assessment_rating.php 34 2009-10-17 13:42:12Z kenreily@gmail.com $ */
/**
 * Short description for file.
 *
 * Long description for file
 *
 * PHP versions 4 and 5
 *
 * Recenseo: Online submission and reviewing for education
 * Copyright 2008-2009, Ken Reily
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * $Date: 2009-10-17 13:42:12 +0000 (Sat, 17 Oct 2009) $
 * $Revision: 34 $
 * $Author: kenreily@gmail.com $
 * $HeadURL: http://recenseo.googlecode.com/svn/trunk/app/models/assessment_rating.php $
 */
class AssessmentRating extends AppModel {
  var $name = 'AssessmentRating';
  var $belongsTo = array('Assessment','AssessmentRatingAttribute','LikertResult');
  var $validate = array('likert_result_id' => array('rule' => 'numeric',
						    'allowEmpty' => false,
						    'message' => 'Please indicate your level of agreement with the statement.'),
			'rating' => array('rule' => 'numeric',
					  'allowEmpty' => false,
					  'message' => 'Please provide a rating for this assessment.'));
		     

  
  function getForAsmt($assessment_id)
  {
      return $this->query("SELECT r.id,ra.id,ra.name,ra.description,l.id,l.name,l.value,r.comments " .
                            "FROM assessment_ratings AS r " .
                            "JOIN assessment_rating_attributes AS ra ON ra.id = r.assessment_rating_attribute_id " .
                            "LEFT OUTER JOIN likert_results AS l ON l.id = r.likert_result_id " .
                           "WHERE r.assessment_id = {$assessment_id}");                           
  }

  
  
}
?>